<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">

<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>首页</title>
    <link rel="stylesheet" th:href="@{/css/semantic.css}"/>
</head>
<body>

<div class="ui container">
    <div class="ui segment" id="index-header-nav" th:fragment="nav-menu">
        <div class="ui secondary menu">
            <a class="item" th:href="@{/index}">首页</a>
            <div class="right menu">
                <div sec:authorize="!isAuthenticated()">
                    <!--未登录-->
                    <a class="item" th:href="@{/toLogin}" ><i class="address card icon"></i>登录</a>
                </div>
                <div sec:authorize="isAuthenticated()">
                    <a class="item">
                        用户名：<span sec:authentication="name"></span>
                    </a>
                </div>
                <div sec:authorize="isAuthenticated()">
                    <!--未登录-->
                    <a class="item" th:href="@{/logout}" ><i class="sign-out icon"></i>注销</a>
                </div>
            </div>
        </div>
    </div>

    <div class="ui segment">
        <h3> Spring security Study</h3>
    </div>

    <div>
        <div class="ui three column stackable grid">
            <div class="column" sec:authorize="hasRole('VIP1')">
                <div class= "ui raised segment">
                    <div class="ui">
                        <div class="content">
                            <h5 class="content">Level 1</h5><hr/>
                            <div><a th:href="@{/level/1/1}"><i class="bullhorn icon"></i> Level-1-1</a></div>
                            <div><a th:href="@{/level/1/2}"><i class="bullhorn icon"></i> Level-1-2</a></div>
                            <div><a th:href="@{/level/1/3}"><i class="bullhorn icon"></i> Level-1-3</a></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="column" sec:authorize="hasRole('VIP2')">
                <div class= "ui raised segment">
                    <div class="ui">
                        <div class="content">
                            <h5 class="content">Level 2</h5><hr/>
                            <div><a th:href="@{/level/2/1}"><i class="bullhorn icon"></i> Leve2-1-1</a></div>
                            <div><a th:href="@{/level/2/2}"><i class="bullhorn icon"></i> Leve2-1-2</a></div>
                            <div><a th:href="@{/level/2/3}"><i class="bullhorn icon"></i> Leve2-1-3</a></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="column" sec:authorize="hasRole('VIP3')">
                <div class= "ui raised segment">
                    <div class="ui">
                        <div class="content">
                            <h5 class="content">Level 3</h5><hr/>
                            <div><a th:href="@{/level/3/1}"><i class="bullhorn icon"></i> Leve3-1-1</a></div>
                            <div><a th:href="@{/level/3/2}"><i class="bullhorn icon"></i> Leve3-1-2</a></div>
                            <div><a th:href="@{/level/3/3}"><i class="bullhorn icon"></i> Leve3-1-3</a></div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>

</div>

<script th:src="@{/js/jquery.js}"></script>
<script th:src="@{/js/semantic.js}"></script>
</body>
</html>